class AuthenticateController < ApplicationController
  def index
  end

  def login
    session[:user_id] = nil
    if request.post?
      user = User.authenticate(params[:name], params[:password])
      if user
        session[:user_id] = user.id
        session[:username] = user.username
        redirect_to :action => "index"
      else
        flash[:notice] = "Invalid user/password combination"
      end
    end
  end

  def logout
  end

end
